package com.antler.smt.portal.controller;

import com.antler.smt.portal.annotation.OperateCut;
import com.antler.smt.response.base.Result;
import com.antler.smt.response.portal.GetOrderCommentListResp;
import com.antler.smt.service.portal.OrderCommentService;
import com.antler.smt.utils.LogUtil;
import com.antler.smt.validate.DataValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 订单评价显示接口
 *
 * @author zhangyi
 * @date 2018/4/16 13:52
 */
@RestController
@RequestMapping("/orderComment")
@Api(description = "订单评价显示接口")
public class OrderCommentController {
    /**
     * 日志
     */
    private static Logger log = LogUtil.get();


    @Resource
    private OrderCommentService orderCommentService;

    /**
     * 获取订单评价信息(首页显示)
     *
     * @return Result实体
     */
    @GetMapping ("/getOrderCommentList")
    @ApiOperation(value = "获取订单评价信息(首页显示)", httpMethod = "GET")
    @OperateCut(operationContent = "浏览订单评价信息")
    public Result getOrderCommentList() {
        Result result = null;
            result = orderCommentService.getOrderCommentList();
        return result;
    }

    /**
     * 获取订单评价信息
     *
     * @return Result实体
     */
    @GetMapping("/getOrderComment")
    @ApiOperation(value = "获取订单评价信息", httpMethod = "GET")
    public Result<GetOrderCommentListResp> getOrderComment(@RequestParam(value = "orderId") Long orderId) {

        DataValidator.isBlank(String.valueOf(orderId),"订单id不能为空！");

        Result result = null;
            result = orderCommentService.getOrderInfoByOrderIdShowPurchaser(orderId);
        return result;
    }

}
